package service

import (
	"context"
	api "{{package_info.api}}"
	model "{{package_info.model}}"
)

type I{{table_info.firstUpperName}} interface {
	List(ctx context.Context, req *api.{{table_info.firstUpperName}}ListReq) (total interface{}, res []*model.{{table_info.firstUpperName}}Info, err error)
	Add(ctx context.Context, req *api.{{table_info.firstUpperName}}AddReq) (err error)
	Edit(ctx context.Context, req *api.{{table_info.firstUpperName}}EditReq) (err error)
	Delete(ctx context.Context, id uint) (err error)
	BatchDelete(ctx context.Context, ids []uint) (err error)
	GetById(ctx context.Context, id uint) (res *model.{{table_info.firstUpperName}}Info, err error)
}

var local{{table_info.firstUpperName}} I{{table_info.firstUpperName}}

func {{table_info.firstUpperName}}() I{{table_info.firstUpperName}} {
	if local{{table_info.firstUpperName}} == nil {
		panic("implement not found for interface I{{table_info.firstUpperName}}, forgot register?")
	}
	return local{{table_info.firstUpperName}}
}

func Register{{table_info.firstUpperName}}(i I{{table_info.firstUpperName}}) {
	local{{table_info.firstUpperName}} = i
}
